Please note that JavaScript is currently only available in Netscape Navigator 2.0 or later, and in Internet Explorer for MacOS version 3.0.1 or later.
Internet Explorer's implementation for JavaScript, sometimes called JScript, is slighly different from Netscape's implementation. Version 3.0 of of Internet Explorer for MacOS doesn't support JavaScript, this was introduced in Internet Explorer version 3.0.1 b1. Do not assume that all in your audience are using a JavaScript enabled browser.
The script is named GetRandomURL and it is placed in the HEAD section of the HTML document. The script is executed by clicking on a link containing a call to GetRandomURL(). Also note the custom text in the browser's status area when the cursor is over the link.
Example of this script picking a random page.
How to use:
Replace the filenames inside the script with your own URLs and edit this page contents inside the <BODY> section. You can also copy the entire script to an existing page.function GetRandomURL() { var locationlist = new URLList ( "harpo.html", "groucho.html", "chico.html", "zeppo.html", "http://home.netscape.com/eng/mozilla/Gold/handbook/javascript/" ); Use code similar to this to let the user execute the script:
random Note that there seems to be an undocumented limit to the number of URLs that can be placed in the list, so if you have a large number of links, (more than 40 or 50), you may need to create multiple lists and extend the function GetRandomURL() to initially select a list at random.